/**
 * Created by Administrator on 2017/3/21.
 */
import React, { Component, Fragment } from 'react';
import {
  Form,
  Button,
  Badge,
  Select,
  DatePicker,
  Radio,
  Descriptions,
  Input,
  Upload,
  Icon,
  TreeSelect,
  InputNumber,
} from 'antd';
import {connect} from 'dva';
import moment from 'moment'
import request from '@/utils/request';
import config from '@/config/config'
const { TextArea } = Input;
const { Option } = Select;
const TreeNode = TreeSelect.TreeNode;
const FormItem = Form.Item;
const ButtonGroup = Button.Group;
let uuid = 2;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.modelName=window.location.pathname.slice(1)
    this.state = {
    };
  }

  render() {
    const {getFieldDecorator} = this.props.form;

    return (
      <div>
        <Form>
          <Descriptions column={4} className={'blue-descriptions'}  title={<div style={{textAlign:'center'}}>详情</div>} bordered>
            <Descriptions.Item label="日期" span={4}>
              {getFieldDecorator('date', {
                initialValue:this.props.editRecord?moment(this.props.editRecord.date):moment(),
              })(
                <DatePicker allowClear={false} style={{width:'100%'}}/>
              )}

            </Descriptions.Item>
            {
              (this.modelName==='standing_books1'||this.modelName==='standing_books3')&&
                <Fragment>
                  <Descriptions.Item label="设备名称" span={4}>
                    {getFieldDecorator('name', {
                      initialValue:this.props.editRecord?this.props.editRecord.parameters.name:'',
                    })(
                      <Input style={{width:'100%'}}/>
                    )}

                  </Descriptions.Item>
                  <Descriptions.Item label="数量" span={4}>
                    {getFieldDecorator('count', {
                      initialValue:this.props.editRecord?this.props.editRecord.parameters.count:'',
                    })(
                      <Input style={{width:'100%'}}/>
                    )}
                  </Descriptions.Item>
                  <Descriptions.Item label="管理人员" span={4}>
                    {getFieldDecorator('admin', {
                      initialValue:this.props.editRecord?this.props.editRecord.parameters.admin:'',
                    })(
                      <Input style={{width:'100%'}}/>
                    )}
                  </Descriptions.Item>
                  <Descriptions.Item label="设备" span={4}>
                    {getFieldDecorator('device', {
                      initialValue:this.props.editRecord?this.props.editRecord.parameters.device:'',
                    })(
                      <Input style={{width:'100%'}}/>
                    )}
                  </Descriptions.Item>
                </Fragment>
            }
            {
              this.modelName==='standing_books2'&&
              <Fragment>
                <Descriptions.Item label="地点" span={4}>
                  {getFieldDecorator('address', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.address:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="清淤人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否清淤完毕" span={4}>
                  {getFieldDecorator('ended', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.ended:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="备注" span={4}>
                  {getFieldDecorator('remark', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.remark:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              this.modelName==='standing_books4'&&
              <Fragment>
                <Descriptions.Item label="地点" span={4}>
                  {getFieldDecorator('address', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.address:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="是否维护" span={4}>
                  {getFieldDecorator('fixed', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fixed:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否维修" span={4}>
                  {getFieldDecorator('repaired', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.repaired:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="参与人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="备注" span={4}>
                  {getFieldDecorator('remark', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.remark:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
            (this.modelName==='standing_books5'||
              this.modelName==='standing_books10')&&
              <Fragment>
                <Descriptions.Item label="管径" span={4}>
                  {getFieldDecorator('border', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.border:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="是否维护" span={4}>
                  {getFieldDecorator('fixed', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fixed:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否维修" span={4}>
                  {getFieldDecorator('repaired', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.repaired:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="参与人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              this.modelName==='standing_books6'&&
              <Fragment>
                <Descriptions.Item label="地点" span={4}>
                  {getFieldDecorator('address', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.address:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="参与人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否疏通完毕" span={4}>
                  {getFieldDecorator('ended', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.ended:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="备注" span={4}>
                  {getFieldDecorator('remark', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.remark:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              (this.modelName==='standing_books7'|| this.modelName==='standing_books8')&&
              <Fragment>
                <Descriptions.Item label="地点" span={4}>
                  {getFieldDecorator('address', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.address:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="是否维护" span={4}>
                  {getFieldDecorator('fixed', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fixed:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否维修" span={4}>
                  {getFieldDecorator('repaired', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.repaired:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="参与人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="备注" span={4}>
                  {getFieldDecorator('remark', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.remark:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
            {
              (this.modelName==='standing_books9')&&
              <Fragment>
                <Descriptions.Item label="地点" span={4}>
                  {getFieldDecorator('address', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.address:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}

                </Descriptions.Item>
                <Descriptions.Item label="是否维护" span={4}>
                  {getFieldDecorator('fixed', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fixed:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="是否维修" span={4}>
                  {getFieldDecorator('repaired', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.repaired:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="参与人员" span={4}>
                  {getFieldDecorator('member', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.member:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="减压阀阀前压力" span={4}>
                  {getFieldDecorator('fqyl', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fqyl:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
                <Descriptions.Item label="减压阀阀后压力" span={4}>
                  {getFieldDecorator('fhyl', {
                    initialValue:this.props.editRecord?this.props.editRecord.parameters.fhyl:'',
                  })(
                    <Input style={{width:'100%'}}/>
                  )}
                </Descriptions.Item>
              </Fragment>
            }
          </Descriptions>
        </Form>

      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);
